package cate.game.role.farm.adventure.msg;


import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBAdventure;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "领取主线奖励 の 请求")
@OperationSetter(GDOperation.ADVENTURE_PASS_REWARD)
public class AdventurePassRewardReq implements MsgInput {
    @NoteField("通关奖励id")
    public int id;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult passReward = cc.getRole().getFarm().adventure.getPassReward(id);
        if (passReward.ok()){
            cc.getRole().getHistory().action.adventurePassRewardGet(id);
        }else {
            cc.getRole().getGame().notice.message(cc.getRole(),passReward.contentId, passReward.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBAdventure.ADVENTURE_PASS_REWARD_REQ;
    }
}
